#ifndef DIALOGCALIBCAMS_H
#define DIALOGCALIBCAMS_H

#include <QDialog>
#include<QtCore>


/////////////////////////////////////////
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
/////////////////////////////////////////

namespace Ui {
class dialogCalibCams;
}

class dialogCalibCams : public QDialog
{
    Q_OBJECT
    
public:
    explicit dialogCalibCams(QWidget *parent = 0);
    ~dialogCalibCams();

    
private:
    Ui::dialogCalibCams *ui;
    int playback;                   // 1: Playback, 0: Not Playing
    int not_eof_1,not_eof_2;                // end of file status
    cv::VideoCapture capFile_0;     //VideoFile Capture, file 1
    cv::VideoCapture capFile_1;     //VideoFile Capture, file 2

    cv::Mat matVideoFile_0;           //Frame Captured From Video File 1
    cv::Mat matVideoFile_1;           //Frame Captured From Video File 2

    QTimer* tmrTimer;

    QString filename_1;           // Name of the AVI file to read, camera 1
    QString filename_2;         // Name of the AVI file to read, camera 2

    int high;     //number of internal chessboard corners high
    int wide;      //number of internal chessboard corners wide
    float squareSize;  //chessboard square size, in units (ie millimeters)
    int framesToGrab;   //number of calibration images to grab
    int delayBetween;   //delay between grabs

    void initializeCamera(cv::VideoCapture cam);
    void doit(int cam);

public:
    QString projdir;
    int resWidth,resHeight; //camera resolution (eg w=1280, h=720)

private slots:
    void on_pushButton_Playback_Stop_clicked();

    void on_pushButton_CalibCam1_clicked();

    void on_pushButton_CalibCam0_clicked();

public slots:
    void processFrameAndUpdateGUI();

};

#endif // DIALOGCALIBCAMS_H
